namespace Architecture.Domain.BankManagement.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitDb : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Comptes",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        TypeCompte = c.Int(nullable: false),
                        OpenedDate = c.DateTime(nullable: false),
                        ClosedDate = c.DateTime(),
                        Owner_Id = c.Guid(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Clients", t => t.Owner_Id)
                .Index(t => t.Owner_Id);
            
            CreateTable(
                "dbo.Clients",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        FirstName = c.String(),
                        LastName = c.String(),
                        Birthday = c.DateTime(nullable: false),
                        Nationality_Id = c.Guid(),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Countries", t => t.Nationality_Id)
                .Index(t => t.Nationality_Id);
            
            CreateTable(
                "dbo.Countries",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Name = c.String(),
                        CodeISO = c.String(),
                    })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Comptes", "Owner_Id", "dbo.Clients");
            DropForeignKey("dbo.Clients", "Nationality_Id", "dbo.Countries");
            DropIndex("dbo.Clients", new[] { "Nationality_Id" });
            DropIndex("dbo.Comptes", new[] { "Owner_Id" });
            DropTable("dbo.Countries");
            DropTable("dbo.Clients");
            DropTable("dbo.Comptes");
        }
    }
}
